<template>
  <div class="box">
    <div class="left">
      <img src="@/assets/bg.jpg" alt="" class="layouts">
      <div class="info">
        <div class="item" v-for="item in [1, 2, 3, 4]" :key="item">
          <el-icon size="30px" color="#79bbff">
            <Iphone />
          </el-icon>
          <div class="title">支持移动全平台</div>
          <div class="text">支持Android/iOS移动平台，如手机、ipad、Watch、Android模拟器等。提供给PerfDog软件Windows & Mac版本</div>
        </div>
      </div>
    </div>
    <div class="right">
      <div class="hwid-input-area">
        <div class="hwid-input">
          <input type="text" placeholder="请输入账户" v-model="state.username" />
        </div>
        <div class="hwid-input" style="margin-top: 25px;">
          <input type="password" placeholder="请输入密码" v-model="state.password" />
        </div>
      </div>
      <div class="btn" @click="login">
        <div class="text">登录</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, reactive } from "vue";
import { useRouter } from 'vue-router'

const state = reactive({
  username: localStorage.getItem("name") ?? '',
  password: localStorage.getItem("password") ?? '',
})

window.addEventListener('keydown', e => {
  if (e.keyCode == 13) {
    login()
  }
})

const router = useRouter()
const login = () => {
  console.log(state.username, state.password)
  router.push('/home')
}

</script>

<style scoped lang="scss">
.box {
  width: 1350px;
  height: 850px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  overflow: hidden;
  padding: 50px 0 100px 0;

  .left {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 60px;
    background-size: 100% 100%;

    .layouts {
      width: 100%;
      height: 320px;
      z-index: 9;
    }

    .info {
      width: 100%;
      height: calc(100% - 300px);
      display: grid;
      grid-template-columns: 1fr 1fr;

      .item {
        padding: 20px 20px 0 0;

        .title {
          margin-top: 10px;
          font-size: 15px;
          font-weight: 600;
          position: relative;

          &:before {
            position: absolute;
            top: 2px;
            left: -10px;
            content: '';
            width: 2px;
            height: 20px;
            background-color: #409EFF;
          }
        }

        .text {
          margin-top: 10px;
          color: #666;
          line-height: 20px;
        }
      }
    }
  }

  .right {
    width: 100%;
    text-align: center;
    border-left: 1px solid #ccc;
    padding-top: 200px;

    .hwid-input-area {
      width: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      margin-bottom: 40px;

      .hwid-input {
        background: rgba(0, 0, 0, 0.05);
        border: 1px solid transparent;
        border-radius: 12px;

        input {
          border: none;
          height: 46px;
          width: 320px;
          padding: 0 24px;
          box-sizing: border-box;
          background-color: rgba(0, 0, 0, 0.05);
        }

        input:focus-visible {
          border: none;
          outline: none;
        }
      }
    }

    .btn {
      width: 320px;
      height: 46px;
      background: linear-gradient(104deg, #CA141D 0%, #e6313a 100%);
      border-radius: 12px;
      margin: 0 auto;
      line-height: 46px;
      color: #ffffff;
      position: relative;
      overflow: hidden;
      margin-bottom: 50px;
      font-size: 12px;

      .text {
        position: relative;
        z-index: 99;
      }

      &:after {
        position: absolute;
        top: 0;
        left: 0;
        display: block;
        content: "";
        width: 320px;
        height: 46px;
        transform: translateX(-100%);
        transition: all 0.5s ease;
        border-radius: 12px;
        background: linear-gradient(104deg, #CA141D 0%, #e6313a 100%);
      }

      &:hover {
        cursor: pointer;

        &:after {
          transform: translateX(0);
        }
      }
    }
  }
}
</style>
